'use strict'
import {testResults} from "../services/studyService";

export default {

  namespace: 'study',

  state: {
    testRecords: [],//周测记录
  },

  subscriptions: {
    setup({dispatch, history}) {  // eslint-disable-line
    },
  },

  effects: {
    //拉取周测记录
    * testResults({val}, {call, put}) {
      const res = yield call(_ => testResults(val));
      const {data = []} = res || {};
      yield put({type: 'testRecords', data});
    },
  },

  reducers: {
    testRecords(state = {}, {data = []}) {
      return {...state, testRecords: data};
    },
  },
};
